import { defineStore } from 'pinia'
export interface NavConfig {
    twoMenu:any[],
    threeMenu:string[],
    click_menu: string[], //这个就是一级菜单
    all:string[],
    indexActive:number,
    clickGrade:number
}
export const useNavConfig = defineStore('navConfig', {
    state: (): NavConfig => {
        return {
            twoMenu:[],
            threeMenu:[],
            click_menu: [],
            all:[],
            indexActive:0,
            clickGrade:0
        }
    },
    actions: {
        dataFill(state:any) {
            this.$state.click_menu = state
        },
        setHeadNav(all:any) {
            this.$state.all = all
        },
        setTwoNav(twoMenu:any) {
            this.$state.twoMenu = twoMenu
        },
        setThreeNav(threeMenu:any) {
            this.$state.threeMenu = threeMenu
        },
        removeMenu() {
            this.twoMenu = []
            this.threeMenu = []
        },
        removeThree() {
            this.threeMenu = []
        },
        setIndex(index:number){
            this.$state.indexActive = index
        },
        setClickGrade(grade:number){
            this.$state.clickGrade = grade
        },
    },
    persist: {
        key: 'navConfig',
    },
})